Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4599798pxj; Wed, 12 May 2021 09:00:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtJHpHqso6B7/thYvrNykBrSUoZFmHDB52JR2Z+D9HjQ4MM3Y/xyigBRjTrHm4E6Vxj/eb X-Received: by 2002:aa7:d6d9:: with SMTP id x25mr44835386edr.305.1620835245025; Wed, 12 May 2021 09:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835245; cv=none; d=google.com; s=arc-20160816; b=Jd7lOPJ1a70aeBWy+fVzFjOiCow0wZw6c/9UMjg877jQd73wyhiN6qOkuwmEEysaLD 5oYHA1nyUEGEnMscOvgNMVLdgVL7TLgHlix3n92ZuvdCsJaaCkIPOh1j1yMGiOk6P5l0 sCpi6zxaOG995M9XKqIOLlsa+Xj7Z8T8MTIn0I71yTYw/GiRYp9OAx+W/M9jZk6+hbVG K7ckOypFO7VVvfDPzWN6JF+vafwwBtCZ3ocCW6lwSuAvpjyfQr+upMxcoKEDeiRTcJBq Hyg76asONDBOmESV+pSHFCvG1ZgFFoy4XJLP/xDyIRwFZpPVMbKRqOvizbzSmMDR7Zeo 6Hcw== 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=nOUfp02Wvv48yPzAOxqB89rZeQcr0FiXDBdVW73J6kQ=; b=ut8NZspXjrOglF5acXF75OLyUYfM/DcSeSnI3TW01xk1ikh6pIvPSAyVu9MXS0Tk88 2aaDFsU5bBVKBxiq2OEl+ItrTdnfPGj5wE32bIvPkig8wY6MEN4udWV+41tKHKQLYZOT r+b2QiSLNHrL6LRKukcpYfvtKTd2r+iri9vh2Bhsq4Fg7Eus2wQr/hwgjfW17ApsgHoZ ZvSYABdLqfmJZ+SGzOOtciatPO28S4cyYDN1M1J5nYFvhcZdJrMI3daHEmDMSwFoG5jw DgeqFf5x9JgVt3RJBn5u6pZJ+OPJT6GVChtNXAphR6mQ6YXkN86J8I65bZo3SCLXQIE6 05Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QtJuxxs5; 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 w14si76152edc.366.2021.05.12.09.00.20; Wed, 12 May 2021 09:00:45 -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=QtJuxxs5; 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 S238011AbhELP5E (ORCPT + 99 others); Wed, 12 May 2021 11:57:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:40904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbhELP1c (ORCPT ); Wed, 12 May 2021 11:27:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE51661C1B; Wed, 12 May 2021 15:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832349; bh=J9cJo23zK/3+m4CkPC9+6rXi/ZvGwdrqclw+xclHUqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtJuxxs5dXhJypS41e/ePHA5mB2muFiAlN4vtbzPRsx/QCfqbpuiqc0FEkE5OJ8zT Ot3ZJN/NdM+Kx2Yg+ywaaK6odu8mKcmdTUyHBSakptAZ6dzsbk6l+4FBw5FAEj8LlH jW9xJV8uO+mtgteoLSFJfLcWMtOqdnlZ3cPsuqdY= 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 243/530] USB: cdc-acm: fix unprivileged TIOCCSERIAL Date: Wed, 12 May 2021 16:45:53 +0200 Message-Id: <20210512144827.823018960@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 dd5619582d60007139f0447382d2839f4f9e339b ] TIOCSSERIAL is a horrid, underspecified, legacy interface which for most serial devices is only useful for setting the close_delay and closing_wait parameters. A non-privileged user has only ever been able to set the since long deprecated ASYNC_SPD flags and trying to change any other *supported* feature should result in -EPERM being returned. Setting the current values for any supported features should return success. Fix the cdc-acm implementation which instead indicated that the TIOCSSERIAL ioctl was not even implemented when a non-privileged user set the current values. Fixes: ba2d8ce9db0a ("cdc-acm: implement TIOCSSERIAL to avoid blocking close(2)") Acked-by: Oliver Neukum Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20210408131602.27956-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/class/cdc-acm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 0876468c2e7d..63824552e5d0 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -955,8 +955,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) if ((close_delay != acm->port.close_delay) || (closing_wait != acm->port.closing_wait)) retval = -EPERM; - else - retval = -EOPNOTSUPP; } else { acm->port.close_delay = close_delay; acm->port.closing_wait = closing_wait; -- 2.30.2