Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597876pxj; Wed, 12 May 2021 08:58:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoH/+27XN3zijSWezU6tAudKzCNE9g4924wkDjagw2sjKLOqKmukBJw5tXfrCD6JPJerTo X-Received: by 2002:a5d:4947:: with SMTP id r7mr45820666wrs.217.1620835109154; Wed, 12 May 2021 08:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835109; cv=none; d=google.com; s=arc-20160816; b=f41u8YpvRHIr815cDDw1kBvt24FTb56Xqia7cOO/WJf/j8pbQYS8OF58PeO3OcbRVI 1lJTspXknNmYGLAbiNy/CU8ev+ZnstkSGzzrkoZb9aIhCL479HNsfs/O3HF9ugoR94x8 TeaWQgKHRexi9SSzkZZ7L5BmLJnKKgzf10VgLYwtcbJgsQhmovSAUaEZeAqmyVZOI0bJ idvHI0iND3dM7/cUE4mJYdEnmleyMxi7ApzqtA8Lk4vCxUvFEcihnxzzyAfYVjAMWD/T uGRJR6+FJrW0/Hjmo+s1nMeTlgngfviFJVM7xdz7NOFEH9AvRssi7KBr4H+69BW1vfGJ jF4A== 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=FGL0NeRh0GN/keDedYMqsg8Ttj+1L/abOpDLCElZhdE=; b=GHsA6ltnDX1ocS4v//yCBFGZGQFTHW4SL/7GIXpgMKqp5NmDyT627JT0ijuSq22lsp zFIc0qSK8e/gJH9eT80i85CwziSL7bf51GIC3OvHkdPGTI5l9CERF7nJZdACcIy+nwA2 ydgy8qMzvf3C6J1P23es4JTEbildjtSi7poJ2aTbMMkGPY3JWAtMGt+6pnS8RIVtM03o LupDQNKTtHCeM4LbukGTrki6bTRX3bu19ayXVUIBsxxvCMN7p4qb7LLJbJQg1hn1/sL1 GCGK41WVpJMOCKtQlyTEI/8wdSz2RWl5xWflrXDLpo0HAXWJWL8Z/AFpWecjkcCT62JO LTaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MWfsRn35; 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 r12si768775wmq.5.2021.05.12.08.58.04; Wed, 12 May 2021 08:58:29 -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=MWfsRn35; 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 S238215AbhELP5c (ORCPT + 99 others); Wed, 12 May 2021 11:57:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:38874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235384AbhELP1o (ORCPT ); Wed, 12 May 2021 11:27:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A613C61469; Wed, 12 May 2021 15:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832364; bh=k+qBMd34yBZOoIMBBWJDR/+weETcK7DMKs8guJ02oy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MWfsRn35+hNnEBbZhmsbwvhHsPFXNzOoOx5eeKuW0GpiisUlgutYFdQhhhn5FHlO9 C6KMOdw33HBQwmQbhujKRLckbRtpxdv2+RKmUg9r885xJjYf4rt2k7NDek9Im4cMue ALL+YL28YttXk9Weq0PkIJIGrNCgOZAzKpLOCpO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Sasha Levin Subject: [PATCH 5.10 248/530] tty: fix return value for unsupported termiox ioctls Date: Wed, 12 May 2021 16:45:58 +0200 Message-Id: <20210512144827.987234069@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 8871de06ff78e9333d86c87d7071452b690e7c9b ] Drivers should return -ENOTTY ("Inappropriate I/O control operation") when an ioctl isn't supported, while -EINVAL is used for invalid arguments. Support for termiox was added by commit 1d65b4a088de ("tty: Add termiox") in 2008 but no driver support ever followed and it was recently ripped out by commit e0efb3168d34 ("tty: Remove dead termiox code"). Fix the return value for the unsupported termiox ioctls, which have always returned -EINVAL, by explicitly returning -ENOTTY rather than removing them completely and falling back to the default unrecognised- ioctl handling. Fixes: 1d65b4a088de ("tty: Add termiox") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20210407095208.31838-4-johan@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/tty_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 4de1c6ddb8ff..803da2d111c8 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -774,8 +774,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, case TCSETX: case TCSETXW: case TCSETXF: - return -EINVAL; -#endif + return -ENOTTY; +#endif case TIOCGSOFTCAR: copy_termios(real_tty, &kterm); ret = put_user((kterm.c_cflag & CLOCAL) ? 1 : 0, -- 2.30.2