Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp176708pxx; Wed, 28 Oct 2020 01:42:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRps8nPGVcMSYT/6rgOegNpsPJ/eya1iy4FnxMJ8f9icX0WRpePpDe7crQq3UjUqWcCABj X-Received: by 2002:a17:907:2662:: with SMTP id ci2mr6301466ejc.554.1603874529606; Wed, 28 Oct 2020 01:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874529; cv=none; d=google.com; s=arc-20160816; b=dpsrDJneLCLaiyPL5NfJwTq81eNDLd2AMEp/L5pgMt0ZfYJlydNPL9rzvuSIUQk038 c0l3jyL6UiEHglZFF1rXub9YIbEknREXD777joDczFHu4Kt11Cu7cL8p999lXGmF7NmF yw8JfUo9l8PBuYfzcLGN1eN++G98dakm9LlP18fmZLih1r9N3Yi1f/2j8RWjWaUvrqXA sJo0zw9f7TWD9LU/Dg3E+1RBDyTJKwLinIdcFvvlGYSGMKauKOa5f8RFKVdJCBJmIUoo ORegwWP4dxkPO+/6Jq+rYeBZ0nUfPWuhn3+x8szOUz1QrIQ/dvAkdqGXXRKTf444VJML LGNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g/gug3dtj65BEFBvw1ha+XMshR8gM81NxIday0Eu7DY=; b=AfDFD+7zgyR30eGZ1svCqfUpGX0byLV9MU39X4SoXaBDjwXMMLF9n8kaE2gjV4+4Oh 9ZL++ip8L1bComrXJDao1kcJ3mLU0/V9W+QDq/rUSHaqiQD0zCRsy0h8vSK2sgknHb0y lXjlxX2GC9YJcvYrVGDwirs6iy6TXsNbWv8nVteKGz8SFdQM4d5UDNqeI55oSnyGlOu9 b8WzNX1tHk1Tu9WE8Bim3plSobv+BVsgRBTFph6PifnCTASBf3yq16RCgxoLdMU7YM08 xmUthxdtdQqEXX/FDSNSsU1rNcP3hmI0REZLfly1TKFVk9Hh7UM4tUZxTILbJxg+l4Qy n3xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z26jba8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si2654785ede.591.2020.10.28.01.41.47; Wed, 28 Oct 2020 01:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z26jba8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754958AbgJ0OHt (ORCPT + 99 others); Tue, 27 Oct 2020 10:07:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:56294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754874AbgJ0OHb (ORCPT ); Tue, 27 Oct 2020 10:07:31 -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 1929720757; Tue, 27 Oct 2020 14:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807650; bh=tI1+CMLt7XsKiR4Zum/43ZEg4i5X9EB8R3lNrLX8EWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z26jba8xt129ZxOcePPlm3aLR4+oYhpgBrXAtERS9bv7Xt0IUESnYkVPLA+RgaxLj RhbD5Y50r0IduTsnCFLvRKG5qBC0civ5EDY/17xXnZLHK5LPvSv8PYRBvcuDS50s5c RSp3VtGjcrsywmuYI4gFtnrOiiEMBvSz79FbOLJw= 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 4.9 129/139] tty: ipwireless: fix error handling Date: Tue, 27 Oct 2020 14:50:23 +0100 Message-Id: <20201027134908.275705065@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 c0dfb642383b2..dc7f4eb18e0a7 100644 --- a/drivers/tty/ipwireless/network.c +++ b/drivers/tty/ipwireless/network.c @@ -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); diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index 2685d59d27245..4f9690442507f 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c @@ -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; } -- 2.25.1