pty: Fix buffer flush deadlock
[firefly-linux-kernel-4.4.55.git] / drivers / tty / tty_buffer.c
index 3605103fc1ac6d891f255fea127f6fbd8b6ad96b..75661641f5fe068237e7830acd9472383964da3a 100644 (file)
@@ -557,3 +557,9 @@ int tty_buffer_set_limit(struct tty_port *port, int limit)
        return 0;
 }
 EXPORT_SYMBOL_GPL(tty_buffer_set_limit);
+
+/* slave ptys can claim nested buffer lock when handling BRK and INTR */
+void tty_buffer_set_lock_subclass(struct tty_port *port)
+{
+       lockdep_set_subclass(&port->buf.lock, TTY_LOCK_SLAVE);
+}