Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp570997rwr; Thu, 27 Apr 2023 05:34:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79omccTaj2cxoimh6HFKPWXFSMCvgd3qRUS+yCXZPgE331UtrXVjPgGmp7Ng6oA8rGIlad X-Received: by 2002:a17:903:22cf:b0:1a9:4167:5db7 with SMTP id y15-20020a17090322cf00b001a941675db7mr1651830plg.4.1682598882662; Thu, 27 Apr 2023 05:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682598882; cv=none; d=google.com; s=arc-20160816; b=u0Ix7MLJkdergVJMl/yB1jXAOzHFSMULf1hdMMWoF/z7Wi0YDeEbw6RlB7abJtUJ+o L+cxAWgjp29Vd/dFussEcRZcywd0kaSDzH+GPRmynPkfx0+mzd47tLdwW1WH/023OFzP 84MUYQECXw2JDOds2wIxXA97WN2HwplMCMgjNS3ypaXL1ot8lY6395i9LfjDvGKoP02O SvhnKfEq2q/xJJeER3nRvxHFDmheYIa1yD3niwkBDud/72vjRlAHwsEy2ZPXvYOUKKp9 cNei8oMf2FSRB+FSVVAplFUr57hV98hDtzzcPemgkR9FnfhSYa+s5vKk3dOfhMBWL9wV o3OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Inuqo6kreLF4kHgiepo1v5zy5YDxOJc89PmnNw7HbjY=; b=ZG653ImHBT2t/F74Q9FLjeKZd7c1yx00FE7MCB33iqHo6F/4WL8Sk5aPZT940fE1+e 2akAamPXuqoNCSzRf0n3CY7pI45PVREYgkg33thSQgRxRDCqpNMQFicp8GfzTbQDJW0s e1Jz0EJW1tq52D03tElTt5pQz8G3Gs75j+50ZRsORbXAK4Ga5L4O6Ve6yIsVnfhu5ei/ +Xqs6VL+R7Ou/e5BvsQ5+y0KgwuzurrK647qsTjtGSWsoR5Gv/7pDcDE5J4mj0sj6JEO 1hYxHwSQst9SM44zQaSEExW7ZKPEMbELOs5KzWaNreLAScVqK5+3n4O79EnxHQhfEjvx GOlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a170902ebc900b001a922c7f51dsi18264622plg.172.2023.04.27.05.34.31; Thu, 27 Apr 2023 05:34:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243964AbjD0MNg (ORCPT + 99 others); Thu, 27 Apr 2023 08:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243908AbjD0MNB (ORCPT ); Thu, 27 Apr 2023 08:13:01 -0400 Received: from www484.your-server.de (www484.your-server.de [78.47.237.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E31469E; Thu, 27 Apr 2023 05:12:39 -0700 (PDT) Received: from sslproxy02.your-server.de ([78.47.166.47]) by www484.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ps0AK-000Duq-2I; Thu, 27 Apr 2023 13:52:00 +0200 Received: from [2003:ca:6730:e8f8:a2c4:4e1c:f83c:db4b] (helo=tethys.gateware.dom) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ps0AJ-000Hyr-Av; Thu, 27 Apr 2023 13:51:59 +0200 From: =?UTF-8?q?Konrad=20Gr=C3=A4fe?= To: Quentin Schulz , Greg Kroah-Hartman , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kyungmin Park , Andrzej Pietrasiewicz , Felipe Balbi Cc: =?UTF-8?q?Konrad=20Gr=C3=A4fe?= , stable@vger.kernel.org Subject: [PATCH v3 2/2] usb: gadget: u_ether: Fix host MAC address case Date: Thu, 27 Apr 2023 13:51:20 +0200 Message-Id: <20230427115120.241954-2-k.graefe@gateware.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230427115120.241954-1-k.graefe@gateware.de> References: <2023042625-rendition-distort-fe06@gregkh> <20230427115120.241954-1-k.graefe@gateware.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Authenticated-Sender: k.graefe@gateware.de X-Virus-Scanned: Clear (ClamAV 0.103.8/26889/Thu Apr 27 09:25:48 2023) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 using "%pmU" to generate an uppercase hex string 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 --- Changes since v2: * Add uppercase MAC address format string and use that instead of manually uppercasing the resulting MAC address string. Changes since v1: * Fixed checkpatch.pl warnings drivers/usb/gadget/function/u_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 6956ad8ba8dd..70e6b825654c 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -963,7 +963,7 @@ int gether_get_host_addr_cdc(struct net_device *net, char *host_addr, int len) return -EINVAL; dev = netdev_priv(net); - snprintf(host_addr, len, "%pm", dev->host_mac); + snprintf(host_addr, len, "%pmU", dev->host_mac); return strlen(host_addr); } -- 2.34.1