tty: ipwireless: fix error handling
authorTong Zhang <ztong0001@gmail.com>
Fri, 21 Aug 2020 16:19:40 +0000 (12:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:05:45 +0000 (09:05 +0100)
[ Upstream commit db332356222d9429731ab9395c89cca403828460 ]

ipwireless_send_packet() can only return 0 on success and -ENOMEM on
error, the caller should check non zero for error condition

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Acked-by: David Sterba <dsterba@suse.com>
Link: https://lore.kernel.org/r/20200821161942.36589-1-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/ipwireless/network.c
drivers/tty/ipwireless/tty.c

index c0dfb642383b29015a81c760a12b06b0452aaa65..dc7f4eb18e0a7a1a0f0df8b1147e9a0d7349e72d 100644 (file)
@@ -116,7 +116,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
                                               skb->len,
                                               notify_packet_sent,
                                               network);
-                       if (ret == -1) {
+                       if (ret < 0) {
                                skb_pull(skb, 2);
                                return 0;
                        }
@@ -133,7 +133,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
                                               notify_packet_sent,
                                               network);
                        kfree(buf);
-                       if (ret == -1)
+                       if (ret < 0)
                                return 0;
                }
                kfree_skb(skb);
index 2685d59d27245ca5a4d7b00d15e7938cdbd4d837..4f9690442507f8a3fe02e89319d1b938bce499b4 100644 (file)
@@ -217,7 +217,7 @@ static int ipw_write(struct tty_struct *linux_tty,
        ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
                               buf, count,
                               ipw_write_packet_sent_callback, tty);
-       if (ret == -1) {
+       if (ret < 0) {
                mutex_unlock(&tty->ipw_tty_mutex);
                return 0;
        }