drivers/tty: add error handling for pcmcia_loop_config
authorZhouyang Jia <jiazhouyang09@gmail.com>
Tue, 12 Jun 2018 04:36:25 +0000 (12:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Oct 2018 00:00:51 +0000 (17:00 -0700)
[ Upstream commit 85c634e919bd6ef17427f26a52920aeba12e16ee ]

When pcmcia_loop_config fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling pcmcia_loop_config.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/serial_cs.c

index 933c2688dd7ea90c4a38d7f55938bfc454e9a67c..8106353ce7aa00853bcf4b051b80c1d02310fbbb 100644 (file)
@@ -637,8 +637,10 @@ static int serial_config(struct pcmcia_device *link)
            (link->has_func_id) &&
            (link->socket->pcmcia_pfc == 0) &&
            ((link->func_id == CISTPL_FUNCID_MULTI) ||
-            (link->func_id == CISTPL_FUNCID_SERIAL)))
-               pcmcia_loop_config(link, serial_check_for_multi, info);
+            (link->func_id == CISTPL_FUNCID_SERIAL))) {
+               if (pcmcia_loop_config(link, serial_check_for_multi, info))
+                       goto failed;
+       }
 
        /*
         * Apply any multi-port quirk.