Commit 79c5966c authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

serial: core: return early on unsupported ioctls



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: a5f276f1 ("serial_core: Handle TIOC[GS]RS485 ioctls.")
Fixes: ad8c0eaa ("tty/serial_core: add ISO7816 infrastructure")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210407095208.31838-9-johan@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8b57b3a1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1303,7 +1303,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;
@@ -1327,7 +1327,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;
@@ -1347,7 +1347,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;