X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Ftty%2Ftty_port.c;h=c94d2349dd0620dd183645ee37ddced4551e9ccd;hb=0891ad829d2a0501053703df66029e843e3b8365;hp=f597e88a705d1fa8e65cf36ae98a61f84f20b9a3;hpb=42249094f79422fbf5ed4b54eeb48ff096809b8f;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index f597e88a705d..c94d2349dd06 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -140,6 +140,10 @@ EXPORT_SYMBOL(tty_port_destroy); static void tty_port_destructor(struct kref *kref) { struct tty_port *port = container_of(kref, struct tty_port, kref); + + /* check if last port ref was dropped before tty release */ + if (WARN_ON(port->itty)) + return; if (port->xmit_buf) free_page((unsigned long)port->xmit_buf); tty_port_destroy(port); @@ -480,8 +484,6 @@ int tty_port_close_start(struct tty_port *port, if (port->count) { spin_unlock_irqrestore(&port->lock, flags); - if (port->ops->drop) - port->ops->drop(port); return 0; } set_bit(ASYNCB_CLOSING, &port->flags); @@ -500,9 +502,7 @@ int tty_port_close_start(struct tty_port *port, /* Flush the ldisc buffering */ tty_ldisc_flush(tty); - /* Don't call port->drop for the last reference. Callers will want - to drop the last active reference in ->shutdown() or the tty - shutdown path */ + /* Report to caller this is the last port reference */ return 1; } EXPORT_SYMBOL(tty_port_close_start);