Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597700pxj; Wed, 12 May 2021 08:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNIMtCV0DHu+FY+JokcxqDnaqkK7/LzAWEslZ5IUy0Sx65AA2q3MDjvCd225UKRiq10lQ0 X-Received: by 2002:a05:6830:1e71:: with SMTP id m17mr26123762otr.264.1620835092058; Wed, 12 May 2021 08:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835092; cv=none; d=google.com; s=arc-20160816; b=0uYA2ri72/U8+Mc+TjJNqnFF3sYfPN3ikHi6AT5uCt3SwUwxxzY2um3DSt8qB1HS6D wsjQ9xKW+/noV21dVMoYF8sIF4r3XPGxrjbQJeB2PpKMRUA5s9RMlghtkLDF7uKYZE/m 0eVYJlxnGBbQbedqcJHjuP5YBRk0xiiCwatCMqxiqGQEMpBmnb8nHCcWLmQVk9wZispp 7u79KJTmBiKGe6jZnLh5kwj1dF0xSYd3oP9hwchS9Z4ggUJzohTiN8A9iK8aftgDc0xa wBC564qP+bZO4Q7zO7lm/1s2h1+WD+ujghHiwMkuDOQ5ifj5+T2g2MHBbKPZ4Eu+0Ruj cqUQ== 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=LDXTTj/T9yEM3HAJLwApOxyBOjm8PjrfwD99u7O517E=; b=mKgAd24XN9nm2aadhsalfuMXg6ehXXEEPyXdswisTc8HlGaKeEIXXb4iwcCHkgrtmQ qFDniUCO3TKnm4j8WtJyCHSNXLAMjaaQwo7sqERO2BMI0BTwCCbWBBYnB1y4UgOqZkEA eg9AJHOHqF4bHqeRLK0ShGAWJdShMJ3yZa/ctMm09iuyTzi0g4doYseg9oC4GW4vZEog txs/HAAPn2Ea/O27p3ypWnlSEQ53oyN4BNLnzR7Lr84jVOk33BA6gAQ9SI0cQkToSuxX 0nk2GVHD5EOAhu2N1fo2oSoahdZmE65WyatGyFYg53tHRAi/30QirJujrCgda+Ni0TsT jVzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r6yP4rYm; 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 q8si317442otg.199.2021.05.12.08.57.52; Wed, 12 May 2021 08:58:12 -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=r6yP4rYm; 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 S232437AbhELP5q (ORCPT + 99 others); Wed, 12 May 2021 11:57:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:41008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235387AbhELP1p (ORCPT ); Wed, 12 May 2021 11:27:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1DD8761420; Wed, 12 May 2021 15:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832366; bh=cO+b8L5ehmqdNAocuJN5016M8ni8ef4UoTdmNGyFyX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6yP4rYm0ab6uC367CXFdthqcxXX8ESgOKB038GySCMry8rvge8vLdiUylMH1eoG+ Gg6oC70l6wCvm6Vb/uB/Q/+kbS1/I6SrIyEyQbVMIQZvqfPurdsUcGMp1iyG1dDxf+ eV4qkrsRSoNf0IFeh3cHi+p6ShQkb34oLyzV7s24= 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 249/530] serial: core: return early on unsupported ioctls Date: Wed, 12 May 2021 16:45:59 +0200 Message-Id: <20210512144828.025594230@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 79c5966cec7b148199386ef9933c31b999379065 ] Drivers can return -ENOIOCTLCMD when an ioctl is not recognised to tell the upper layers to continue looking for a handler. This is not the case for the RS485 and ISO7816 ioctls whose handlers should return -ENOTTY directly in case a serial driver does not implement the corresponding methods. Fixes: a5f276f10ff7 ("serial_core: Handle TIOC[GS]RS485 ioctls.") Fixes: ad8c0eaa0a41 ("tty/serial_core: add ISO7816 infrastructure") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20210407095208.31838-9-johan@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/serial_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 828f9ad1be49..c6cbaccc19b0 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1306,7 +1306,7 @@ static int uart_set_rs485_config(struct uart_port *port, unsigned long flags; if (!port->rs485_config) - return -ENOIOCTLCMD; + return -ENOTTY; if (copy_from_user(&rs485, rs485_user, sizeof(*rs485_user))) return -EFAULT; @@ -1330,7 +1330,7 @@ static int uart_get_iso7816_config(struct uart_port *port, struct serial_iso7816 aux; if (!port->iso7816_config) - return -ENOIOCTLCMD; + return -ENOTTY; spin_lock_irqsave(&port->lock, flags); aux = port->iso7816; @@ -1350,7 +1350,7 @@ static int uart_set_iso7816_config(struct uart_port *port, unsigned long flags; if (!port->iso7816_config) - return -ENOIOCTLCMD; + return -ENOTTY; if (copy_from_user(&iso7816, iso7816_user, sizeof(*iso7816_user))) return -EFAULT; -- 2.30.2