mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
tty: ipwireless: fix error handling
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>
This commit is contained in:
parent
68778cab29
commit
db33235622
2 changed files with 3 additions and 3 deletions
|
@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
|
||||||
skb->len,
|
skb->len,
|
||||||
notify_packet_sent,
|
notify_packet_sent,
|
||||||
network);
|
network);
|
||||||
if (ret == -1) {
|
if (ret < 0) {
|
||||||
skb_pull(skb, 2);
|
skb_pull(skb, 2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
|
||||||
notify_packet_sent,
|
notify_packet_sent,
|
||||||
network);
|
network);
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
if (ret == -1)
|
if (ret < 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
|
|
@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty,
|
||||||
ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
|
ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
|
||||||
buf, count,
|
buf, count,
|
||||||
ipw_write_packet_sent_callback, tty);
|
ipw_write_packet_sent_callback, tty);
|
||||||
if (ret == -1) {
|
if (ret < 0) {
|
||||||
mutex_unlock(&tty->ipw_tty_mutex);
|
mutex_unlock(&tty->ipw_tty_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue