Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2100064ybl; Thu, 30 Jan 2020 11:21:13 -0800 (PST) X-Google-Smtp-Source: APXvYqyxINz7C0JYhcCQntPK1xhx9X2QOZXardb2Zj3J9jAjE0ONEZh93DaqHBd6x7hgfNom61EV X-Received: by 2002:aca:1903:: with SMTP id l3mr3963215oii.16.1580412073352; Thu, 30 Jan 2020 11:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580412073; cv=none; d=google.com; s=arc-20160816; b=xVZSZDyPvXUYw/rnAnNgWETFLUgEyw6p5qf2P0PFqJunMBdQLR8GAURwU/LQ12k2P8 NbIp12InRQpp4wF8u9Y1D0eQYiHrP3JINqk4HNSYIv0dGMSDIFiqsQv++l9scUoZrVFU wUecjgVDX+p8jxvdqBHnCxBzE+6F4XIxHfPEYEz653H6630q2Lfpw3/dtlbD9731khVM 2XyJ/fCbW9CSUQyUWmuBxkeam/6xKVdaEKRQvuQF85sh1ZBQgKzFgiY3KZY0rJzCSvpJ TmBLuus1wm5R6JxJGmdsL1wah3N/kZVjjTaT0Og6hfraaQaq/L6BDRUcSCm2pp93gmdF 8N1g== 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=kLi0+x3leQ1XM61ceQ9xKkjKVZVWX5jDyWxscw/eR5A=; b=nm0zmQLPRmNxhoAjGgmwFR4jMNYMaIX2EWqWX9nThew7CiwYJJkW6JzAmzPUzOxSqe vcEa7wvJewy54QD8htCTKOBOaNWrjXHjR2GzD7FZ1OFtq2g92R4M+8gw1G3mFraqduSB fA2Q31SbCzcVow090I+SI4sgRkD1AgQoAdL/R5mDhYS8UBqXHRl5hYt89A2kcg4IJcWa HZgLzZpE2j3Ilx+vEH01pEz1F/wFT54zkL2lL6A4y01+EBTaT46XO2FnhrJw/sIwC32E +Yr0kYWROh5wYQ+nkHkShV02VRWZDRCP4pw4Gv8JbIpy5UF1sSu/n83m6ugmExU8nlED ZFAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ztBAIC+g; 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 v25si3354790otq.93.2020.01.30.11.21.01; Thu, 30 Jan 2020 11:21:13 -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=ztBAIC+g; 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 S1731299AbgA3Sq6 (ORCPT + 99 others); Thu, 30 Jan 2020 13:46:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:57198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731277AbgA3Sq4 (ORCPT ); Thu, 30 Jan 2020 13:46:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 138EC20674; Thu, 30 Jan 2020 18:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580410015; bh=UNYeffwflkB4nlDCvZj9SMgwFmgILprKumpSGTZkwe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ztBAIC+gmGdEST6vPbNwos0NTdCYnpTt7jDZvzDXbARzyml4fRBD87kFPwvsP2NY+ gtj8JCeKTr5+NEeEKDEFVv8unB7ztQQguEKJxROGOy1q64YxlwaIukK7+1fRBRMaOp +LDG0PlkdSxuK2W7htl0ZAkhr3njYlh/bUgajJhg= 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.19 05/55] USB: serial: ir-usb: fix link-speed handling Date: Thu, 30 Jan 2020 19:38:46 +0100 Message-Id: <20200130183609.667185696@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.563083888@linuxfoundation.org> References: <20200130183608.563083888@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 @@ -335,34 +335,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 @@ -119,11 +119,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: *