From patchwork Tue Oct 27 13:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 418F8C388F9 for ; Tue, 27 Oct 2020 14:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2F0F207DE for ; Tue, 27 Oct 2020 14:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810057; bh=NUpYaUvmRHTOgcrRsFl9wEtzDPIV1E43uReBfkuDdaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fZ0o0KVn/findOhX7Nuyltg2x9s98H0Oct1y4FuswCBuE+BF8GFlfy05Z1nH2+pA5 32+YXTnNRvf0qgb3SS6jQwx6HoW94OoFuoXUtl5cJM+QM4r7PaYf0du1rOXRahrbE5 rig0Klp8L8Cf4O/a5wzZBhzW+Pf6aRDGm6wWyV3I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765009AbgJ0Orf (ORCPT ); Tue, 27 Oct 2020 10:47:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:47458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764985AbgJ0Ore (ORCPT ); Tue, 27 Oct 2020 10:47:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E91F420709; Tue, 27 Oct 2020 14:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810054; bh=NUpYaUvmRHTOgcrRsFl9wEtzDPIV1E43uReBfkuDdaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efMeYg3GVcBIddbDLyLt1lqDJ2RKfjR3qQmMs7Wm/TFdG1kSMQkaDXWC5BRZYcSM4 nbVG6i9YTLEtpBCae+4sw9sq5iMJHnCDlLNpNqS8EIaoWPeUWZW4Rz7nEgXfcOI3n2 MVhvTg5sg3QeaRy8h1o1gwVEur4wv5ETMiQqBgys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tong Zhang , David Sterba , Sasha Levin Subject: [PATCH 5.4 386/408] tty: ipwireless: fix error handling Date: Tue, 27 Oct 2020 14:55:24 +0100 Message-Id: <20201027135512.904969764@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tong Zhang [ 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 Acked-by: David Sterba Link: https://lore.kernel.org/r/20200821161942.36589-1-ztong0001@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/ipwireless/network.c | 4 ++-- drivers/tty/ipwireless/tty.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c index cf20616340a1a..fe569f6294a24 100644 --- a/drivers/tty/ipwireless/network.c +++ b/drivers/tty/ipwireless/network.c @@ -117,7 +117,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; } @@ -134,7 +134,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); diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index fad3401e604d9..23584769fc292 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c @@ -218,7 +218,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; }