Re: [PATCH 3/4] TTY: pty, release tty in all ptmx_open fail paths

From: Arnd Bergmann
Date: Wed Oct 12 2011 - 09:23:56 EST


On Wednesday 12 October 2011, Jiri Slaby wrote:
> Mistakenly, commit 64ba3dc3143d (tty: never hold BTM while getting
> tty_mutex) switched one fail path in ptmx_open to not free the newly
> allocated tty.
>
> Fix that by jumping to the appropriate place. And rename the labels so
> that it's clear what is going on there.
>
> Introduced-in: v2.6.36-rc2
> Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
> Cc: stable@xxxxxxxxxx
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>

Ok, I have checked that this patch returns the code into the state
before my broken patch, that looks good.

I think I made the same mistake trying to understand your patch
that I made originally when I introduced the bug, which was to
confuse the lifetime of the pty master with the lifetime of the
slave device, so I thought that tty_release should not be called
if we never called ptm_driver->ops->open(), but that's actually
a different device.

Arnd
--
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/