s390/con3270: return from notifier when activate view fails
authorSven Schnelle <svens@linux.ibm.com>
Wed, 7 Dec 2022 21:18:38 +0000 (22:18 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 9 Jan 2023 13:34:06 +0000 (14:34 +0100)
When activating the view fails (in this case because the 3270
is disconnected) return from the notifer callback. Otherwise
the system will deadlock.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/char/con3270.c

index 7d163516ee4533d03c00baacb6851449b1fb7d9b..5fa1f080d5f346666569857fbe02e1e00e6e56b3 100644 (file)
@@ -2079,12 +2079,16 @@ static int con3270_notify(struct notifier_block *self,
 {
        struct tty3270 *tp;
        unsigned long flags;
+       int rc;
 
        tp = condev;
        if (!tp->view.dev)
                return NOTIFY_DONE;
-       if (!raw3270_view_lock_unavailable(&tp->view))
-               raw3270_activate_view(&tp->view);
+       if (!raw3270_view_lock_unavailable(&tp->view)) {
+               rc = raw3270_activate_view(&tp->view);
+               if (rc)
+                       return NOTIFY_DONE;
+       }
        if (!spin_trylock_irqsave(&tp->view.lock, flags))
                return NOTIFY_DONE;
        con3270_wait_write(tp);