Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597802pxj; Wed, 12 May 2021 08:58:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpmLrA+AEpKKgKjOTwQ6Nx7Bw7vZO0zE09IyA8lBAURekkhT/vj2GktkSiX0mOUMQiAA+P X-Received: by 2002:a05:6402:34c5:: with SMTP id w5mr45043112edc.237.1620835099949; Wed, 12 May 2021 08:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835099; cv=none; d=google.com; s=arc-20160816; b=C6O/moqcYxP+oBXWuL8yC5K0ZYMdTMGKLd8Trps70B0FWV1NgtA5WpvFElsDWFSTxq n9slUdeZtXI2tcuhK3tox2Rzv9IkpH8TQE1VU4pMATZn+QA9oFjVk+dy/443+4z5Qz9p 3UckS3+4BBVWrM6RelW0tFnOqnH0M6Uf5DgxEswYu/MiQmaN7gRlbn+5oCABPTSSx5kQ i5Da0WvUpIIGc/Sttyfm8IdIUW6a+eTqD3PLfND/yavwyymJdenJy/37SOQrW3VpKvlk XDZaTKKRMFg02iVjuuNJKpQQUR/KQeLsY3CYFY/ypXi8kQHRao+Tlw9K2w1a0pl/+09r 2Gqg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wpU+Lbx9yw37qHM09DDMNpF90zojamk4o+Oq6qm8g5M=; b=cU8wU8fUh81UftyvfLaeT0hCEz8tUwjKEwc1nu2ss7K41YOKaXNcVeAMDeYaVJn+44 ko+V7uUDMycor/86ySiPKhXOGy1K1jAWSARia/aguSfAgIdo8rX8RxP8XfRInzGGohig hyEcoonaqjMmh9rLRgxAMA9FLDZhShzp2x7qyw4e4cVZI8tN4vNBprmoY+Omz0KCNUXt EyODKBtiRhj7kn6C2psSdl9/47/QPTKF85DYlt4jlC2U6248o00ZjlFIQb8/M25Ll3fJ GceDRv3m5QXquw2/PosOu51kJMe9GfzctGqOl0JQkvnZTM0URb07LNDRP8JwnDSerxoR Ng1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bQj1OcGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si273371ejf.717.2021.05.12.08.57.56; Wed, 12 May 2021 08:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bQj1OcGR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238048AbhELP5L (ORCPT + 99 others); Wed, 12 May 2021 11:57:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:38716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235310AbhELP1b (ORCPT ); Wed, 12 May 2021 11:27:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6162D61C1A; Wed, 12 May 2021 15:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832351; bh=9d8e1kro+x5O+R31gGBlA+yRlL4lLFXIDtIe7ShIsyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQj1OcGRO4NAORNdV2H53ChOFa8HQbo7MeRxmbBkuy/Nn9mDeo+LXnZf0gyo6BcjH 1DHTbyFncRLC65UG4G9LGPmfAAfG/Ccc/z24XSaaZRLTVTMQ9Et8OPsPeIrMRkBwTq wlTBo2U5rIBoRzufVq277HoYMQy/LXCfrhTQdG4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Johan Hovold , Sasha Levin Subject: [PATCH 5.10 244/530] USB: cdc-acm: fix TIOCGSERIAL implementation Date: Wed, 12 May 2021 16:45:54 +0200 Message-Id: <20210512144827.855050107@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold [ Upstream commit 496960274153bdeb9d1f904ff1ea875cef8232c1 ] TIOCSSERIAL is a horrid, underspecified, legacy interface which for most serial devices is only useful for setting the close_delay and closing_wait parameters. The xmit_fifo_size parameter could be used to set the hardware transmit fifo size of a legacy UART when it could not be detected, but the interface is limited to eight bits and should be left unset when it is not used. Similarly, baud_base could be used to set the UART base clock when it could not be detected, but might as well be left unset when it is not known (which is the case for CDC). Fix the cdc-acm TIOCGSERIAL implementation by dropping its custom interpretation of the unused xmit_fifo_size and baud_base fields, which overflowed the former with the URB buffer size and set the latter to the current line speed. Also return the port line number, which is the only other value used besides the close parameters. Note that the current line speed can still be retrieved through the standard termios interfaces. Fixes: 18c75720e667 ("USB: allow users to run setserial with cdc-acm") Acked-by: Oliver Neukum Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20210408131602.27956-4-johan@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/class/cdc-acm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 63824552e5d0..6fbabf56dbb7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -929,8 +929,7 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss) { struct acm *acm = tty->driver_data; - ss->xmit_fifo_size = acm->writesize; - ss->baud_base = le32_to_cpu(acm->line.dwDTERate); + ss->line = acm->minor; ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : -- 2.30.2