Re: [PATCH] tty: cleanup prohibition of direct opening for unix98pty master

From: Konstantin Khlebnikov
Date: Wed Jan 04 2012 - 08:26:48 EST


Linus Torvalds wrote:
Looks ok as far as I can tell, and does indeed clean things up. I
assume somebody tested the case that we used to have issues with?

Yes of course I tested it.


Linus

On Tue, Jan 3, 2012 at 12:51 AM, Konstantin Khlebnikov
<khlebnikov@xxxxxxxxxx> wrote:
cleanup hack added in v2.6.27-3203-g15582d3

comment from that patch:

: pty: If the administrator creates a device for a ptmx slave we should not error
:
: The open path for ptmx slaves is via the ptmx device. Opening them any
: other way is not allowed. Vegard Nossum found that previously this was not
: the case and mknod foo c 128 42; cat foo would produce nasty diagnostics
:
: Signed-off-by: Alan Cox<alan@xxxxxxxxxx>
: Signed-off-by: Linus Torvalds<torvalds@xxxxxxxxxxxxxxxxxxxx>

devpts_get_tty() returns non-null only for inodes on devpts, but there is no
inodes for master-devices, /dev/ptmx (/dev/pts/ptmx) is the only way to open them.
Thus we can completely forbid lookup for master-devices and eliminate that hack in
tty_init_dev() because tty_open() will get EIO from tty_driver_lookup_tty().

Signed-off-by: Konstantin Khlebnikov<khlebnikov@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/