Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1966105ima; Thu, 25 Oct 2018 07:41:14 -0700 (PDT) X-Google-Smtp-Source: AJdET5cXRWVKOO0x/SWyawxH38zwL+o5QS33F0v/sr6FqyPRNqNQIYCCDqITq1OR+nMETlay2/+w X-Received: by 2002:a17:902:167:: with SMTP id 94-v6mr1743558plb.142.1540478474382; Thu, 25 Oct 2018 07:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478474; cv=none; d=google.com; s=arc-20160816; b=HiLWf1kBZqng27D0DIsP3RgAOnBQ7adv22IOTer+gq4LtKo7rY23HP326ggR7owJoT +AIi8hf+oVSLsfdIJkOHcOQtM51ZRs645GnSL/GXu2Vc4x9PcpRKbZpVIO3SPnFUWmnn Mdz+a7N+gHvYAQnXfgTZpc/8ojgMmirDYiSm3R7uKuKXICBTH4iuQXvFzrEhr68MvJ9c Qe1Ey0riTXv+c6DuB85WwZ45NmPoAh1Z7PPepmKTHrjw95MWC3+1xZLYggkUWlyCu5G2 sugwT1Aur3b7QE+6SasCSYSFlpxpj6fKdxYueKTCJ54JwZa9TigKXXFtzZnIaPcTLyeD 4VYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kpRbFCHbiaXfdwzseUJu+rE3dpss/jQAoXuOFh2yew8=; b=xAhB2JjcCXWs4nJsfugf/HEHTj34FnVvNl7GYhhENtyUWdyE/w9KnoCxTNNf/5rO/d 0VwmX/Mh3hvKZC5itpO0ZJkxe93kj9Jgwa0ghQgfDRBKh6jc5XlY4k78FakDDwcHFPCF 6LnBNMVl80Vb+/8b17FX5tElZdZ/l0+oOc4Oh4pI6T3CSGbsNeV1MGPMcQOVFqlDx46x wUD4H+DJZiqQbkUm29MErQBm52+ZZjviRtk1jv1gf0mBacj7y9q2AinCEs7dNN/HpPmp PvNqHYtNxEAZGth6vhrGHRD7nvKj13zPfYhBZ68QG/Brr2itK1D6mkxZZmrwIw5FrKpA kHVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xTYBVdy1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7-v6si8300584pgj.116.2018.10.25.07.40.57; Thu, 25 Oct 2018 07:41:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xTYBVdy1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbeJYWsu (ORCPT + 99 others); Thu, 25 Oct 2018 18:48:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:57636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbeJYWss (ORCPT ); Thu, 25 Oct 2018 18:48:48 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 441CA20854; Thu, 25 Oct 2018 14:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476951; bh=POHAzoGDiuPlkXKyz0qs7MSHsjkg1bLPPmFWnt1XtyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTYBVdy1rsj/o8hxeHODFBF4dsHEM9jVd2EjbA7SA6CJ4LzDhiINGgG//U0kuXbDG SjG0fj647hI8BuEbcBGJkvLBIorfBKj8jeSLEVPJHSTFj8MdzL4bh/W8tgPOSOguG9 hKejk2hZo48oMQAWSBmNSskR1Q5NtI3IKyBZWdaU= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Enrico Mioso , Christian Panton , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.9 59/98] net: cdc_ncm: GetNtbFormat endian fix Date: Thu, 25 Oct 2018 10:13:44 -0400 Message-Id: <20181025141423.213774-59-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjørn Mork [ Upstream commit 6314dab4b8fb8493d810e175cb340376052c69b6 ] The GetNtbFormat and SetNtbFormat requests operate on 16 bit little endian values. We get away with ignoring this most of the time, because we only care about USB_CDC_NCM_NTB16_FORMAT which is 0x0000. This fails for USB_CDC_NCM_NTB32_FORMAT. Fix comparison between LE value from device and constant by converting the constant to LE. Reported-by: Ben Hutchings Fixes: 2b02c20ce0c2 ("cdc_ncm: Set NTB format again after altsetting switch for Huawei devices") Cc: Enrico Mioso Cc: Christian Panton Signed-off-by: Bjørn Mork Acked-By: Enrico Mioso Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/cdc_ncm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 3086cae62fdc..7b158674ceed 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -772,7 +772,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ int err; u8 iface_no; struct usb_cdc_parsed_header hdr; - u16 curr_ntb_format; + __le16 curr_ntb_format; ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) @@ -890,7 +890,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ goto error2; } - if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) { + if (curr_ntb_format == cpu_to_le16(USB_CDC_NCM_NTB32_FORMAT)) { dev_info(&intf->dev, "resetting NTB format to 16-bit"); err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_FORMAT, USB_TYPE_CLASS | USB_DIR_OUT -- 2.17.1