stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "serdev: ttyport: enforce tty-driver open() requirement" has been added to the 4.14-stable tree
@ 2017-12-18 12:58 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-12-18 12:58 UTC (permalink / raw)
  To: johan, alexander.levin, gregkh, robh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    serdev: ttyport: enforce tty-driver open() requirement

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serdev-ttyport-enforce-tty-driver-open-requirement.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Mon Dec 18 13:28:59 CET 2017
From: Johan Hovold <johan@kernel.org>
Date: Mon, 16 Oct 2017 15:06:19 +0200
Subject: serdev: ttyport: enforce tty-driver open() requirement

From: Johan Hovold <johan@kernel.org>


[ Upstream commit dee7d0f3b200c67c6ee96bd37c6e8fa52690ab56 ]

The tty-driver open routine is mandatory, but the serdev
tty-port-controller implementation did not treat it as such and would
instead fall back to calling tty_port_open() directly.

Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serdev/serdev-ttyport.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -120,10 +120,10 @@ static int ttyport_open(struct serdev_co
 		return PTR_ERR(tty);
 	serport->tty = tty;
 
-	if (tty->ops->open)
-		tty->ops->open(serport->tty, NULL);
-	else
-		tty_port_open(serport->port, tty, NULL);
+	if (!tty->ops->open)
+		goto err_unlock;
+
+	tty->ops->open(serport->tty, NULL);
 
 	/* Bring the UART into a known 8 bits no parity hw fc state */
 	ktermios = tty->termios;
@@ -140,6 +140,12 @@ static int ttyport_open(struct serdev_co
 
 	tty_unlock(serport->tty);
 	return 0;
+
+err_unlock:
+	tty_unlock(tty);
+	tty_release_struct(tty, serport->tty_idx);
+
+	return -ENODEV;
 }
 
 static void ttyport_close(struct serdev_controller *ctrl)


Patches currently in stable-queue which might be from johan@kernel.org are

queue-4.14/serdev-ttyport-enforce-tty-driver-open-requirement.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-18 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-18 12:58 Patch "serdev: ttyport: enforce tty-driver open() requirement" has been added to the 4.14-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).