Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4027182ybl; Mon, 3 Feb 2020 11:07:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwXVDsLlbKCwQkz0DX7Ul8Gbd44AsqyXdkfbfrx8QQZ3U46Anu77bT9p7jr35AR6dW3I7m0 X-Received: by 2002:a05:6808:a08:: with SMTP id n8mr368931oij.38.1580756830877; Mon, 03 Feb 2020 11:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580756830; cv=none; d=google.com; s=arc-20160816; b=sPHUS2hrC6RV0fS5pZN2dC/mbeCGuF6KCC8cau4J3pWau+AgYGTnNV2Ei6E6+TyZKQ ezVl1c9UK+kXIBVc6Rd8/J4cqGbLFLZK/Wgj/3KGqRwH/uw0G5cliZqISu5X7ipH5Lv2 I6h7yQnD/C66XwbfgwmSXekXEtQj70e3GjEYSvXcozsQmIbC7agP2orNavPSj2geIB/d BMAPAmnrzv+MvLcGZYVF1Ea4in9mkD5N8BxVH25fzYWlv08WMSdej6qm2i8lWs7WBfjQ 11xySDbXhawbklABJBNUcvKTup+ikm+vFvXKtq3SPMFulqPHxkUtKoAJIAWSs7Ci2Azm Zn8A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=og87KMsTatayH7TnBQDHpl7ewwvssMvo4QJevp7N0s4=; b=xV1ON6oilVaZQn5ewSuP7wNr2QJWr2p7AFTwXvTUz2kUH49I4egTHQOUJuKHk9KE4Y edyySbUpO9u+vCCxndIvytnvidgjHaDxjyjpeDwa/ZH2qw7/weDIRcnTCqQjA7p9NR/b 8lgkt7t26B/N4VTZVZXKhXIjVMAiuv60EB6gau3ZvclmpH1easlPnhNW4iquIZtAFpN1 YH/vORsTgQYl7B/Wu4h4oqzNxpYd6AuuQ0nDpFt4GJplb3+RI+lsPHqRFtmzGraSsL2l 4PCqNtVP5BP6fJu4rWutg2r4CudIqSxO2WTjWKQ7w2WKRSI21w3JTf/Rftat/qlSTgNz ovMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qFLmJa+7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20si9247840otf.271.2020.02.03.11.06.50; Mon, 03 Feb 2020 11:07:10 -0800 (PST) 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=qFLmJa+7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729517AbgBCQso (ORCPT + 98 others); Mon, 3 Feb 2020 11:48:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:36660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728725AbgBCQZv (ORCPT ); Mon, 3 Feb 2020 11:25:51 -0500 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEA902051A; Mon, 3 Feb 2020 16:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747150; bh=x4ChrnDWc7hN+raoHbdctHV4ADLdsE1mN+51mfav5R8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFLmJa+7z8iEh85t+mjEUz+OMisOKYyz1GKsk9FzJ5iJOjvhw2/nBbR3oqrco5hcx a+T50vhz/SCDQwF5mxnXnT30rWUUueidYEnCZO8V6hDYcqFnCwMkaLvq3H0O8R3kVq 0NOSSLaze0NzloqSKzGHB2lp4Yxp9wJLhUAi5sW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felipe Balbi , Johan Hovold Subject: [PATCH 4.9 05/68] USB: serial: ir-usb: fix link-speed handling Date: Mon, 3 Feb 2020 16:19:01 +0000 Message-Id: <20200203161905.609571361@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161904.705434837@linuxfoundation.org> References: <20200203161904.705434837@linuxfoundation.org> User-Agent: quilt/0.66 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: Johan Hovold commit 17a0184ca17e288decdca8b2841531e34d49285f upstream. Commit e0d795e4f36c ("usb: irda: cleanup on ir-usb module") added a USB IrDA header with common defines, but mistakingly switched to using the class-descriptor baud-rate bitmask values for the outbound header. This broke link-speed handling for rates above 9600 baud, but a device would also be able to operate at the default 9600 baud until a link-speed request was issued (e.g. using the TCGETS ioctl). Fixes: e0d795e4f36c ("usb: irda: cleanup on ir-usb module") Cc: stable # 2.6.27 Cc: Felipe Balbi Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ir-usb.c | 20 ++++++++++---------- include/linux/usb/irda.h | 13 ++++++++++++- 2 files changed, 22 insertions(+), 11 deletions(-) --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -336,34 +336,34 @@ static void ir_set_termios(struct tty_st switch (baud) { case 2400: - ir_baud = USB_IRDA_BR_2400; + ir_baud = USB_IRDA_LS_2400; break; case 9600: - ir_baud = USB_IRDA_BR_9600; + ir_baud = USB_IRDA_LS_9600; break; case 19200: - ir_baud = USB_IRDA_BR_19200; + ir_baud = USB_IRDA_LS_19200; break; case 38400: - ir_baud = USB_IRDA_BR_38400; + ir_baud = USB_IRDA_LS_38400; break; case 57600: - ir_baud = USB_IRDA_BR_57600; + ir_baud = USB_IRDA_LS_57600; break; case 115200: - ir_baud = USB_IRDA_BR_115200; + ir_baud = USB_IRDA_LS_115200; break; case 576000: - ir_baud = USB_IRDA_BR_576000; + ir_baud = USB_IRDA_LS_576000; break; case 1152000: - ir_baud = USB_IRDA_BR_1152000; + ir_baud = USB_IRDA_LS_1152000; break; case 4000000: - ir_baud = USB_IRDA_BR_4000000; + ir_baud = USB_IRDA_LS_4000000; break; default: - ir_baud = USB_IRDA_BR_9600; + ir_baud = USB_IRDA_LS_9600; baud = 9600; } --- a/include/linux/usb/irda.h +++ b/include/linux/usb/irda.h @@ -118,11 +118,22 @@ struct usb_irda_cs_descriptor { * 6 - 115200 bps * 7 - 576000 bps * 8 - 1.152 Mbps - * 9 - 5 mbps + * 9 - 4 Mbps * 10..15 - Reserved */ #define USB_IRDA_STATUS_LINK_SPEED 0x0f +#define USB_IRDA_LS_NO_CHANGE 0 +#define USB_IRDA_LS_2400 1 +#define USB_IRDA_LS_9600 2 +#define USB_IRDA_LS_19200 3 +#define USB_IRDA_LS_38400 4 +#define USB_IRDA_LS_57600 5 +#define USB_IRDA_LS_115200 6 +#define USB_IRDA_LS_576000 7 +#define USB_IRDA_LS_1152000 8 +#define USB_IRDA_LS_4000000 9 + /* The following is a 4-bit value used only for * outbound header: *