Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp388886pxa; Fri, 21 Aug 2020 09:48:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwv1WksfWXUv9FF9UV8Zmq2XWx1HpZt5g/RtjpdMIEk8EinmSapdvc+VKObn+Gl23TJeuqv X-Received: by 2002:a05:6402:180d:: with SMTP id g13mr3525217edy.277.1598028532691; Fri, 21 Aug 2020 09:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598028532; cv=none; d=google.com; s=arc-20160816; b=lSSCbUgxD+6I2SjKMsJU2lfp1qiXpw2LgqoDBIx9xls36fSLSNjI0NWdDX3y05YmWC si4fv7GY4cbuX9aHm1U9u6Tx/E+hCUm0Zac26v3sJVs3yaw8LF/3NEd7pZ9wUUyUdqHB tu0aH64gd7urBMtoXQtPeuqQ+04erxzspDPPEJLJg3YSJqK4XJN4FcoysZAOBrHQ06Xa 7q3dkaYMYDAfYyBBx6DHUK5h84GBpeC4Cb7tvbKKo0efqssiWx2veK2FTnwx3lc09CVl nkviKHLgarZ+K2WKqNFS2alAEraPZdJL/X53i7vIQMtyBKDHWK2cZBOiqFByLqomuU7v YW2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SnctsuDqqlA5ER6TRf1wGNDf5ctTnVHX934E0v8jiKs=; b=ZsqSN96rbcDiKbGCJYT/hV2BJMsPA1M8Dnh/9ttKU3CEesmvdrhaOVW3O1gmO4zNyP YFKkdkOrCiccON3QFL7pIlsbrBtYZ+63Oig90FT0i2mLWjewaHB6rydK1abUpSs9jvys x0Eaj8PnRy9kzlQtKJMgW1Bivcq6zykct1/CMQ9mUay8dur4Sc434LAKD8/qNZ1NNhrQ PPT5KIDkmZJFpPNyBVZohR6GBifdF4xGm/Q4MvAKLAwcY1PvwrdY7VZWHEtXRv+SrVoK B4lm+gOKkfDipo+qMYXNdw7Ms9a4+CutuEEQL8QzUc16P5lQvdAJWfhsRxJN7qeB9h7X 7esw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="kE2/rzVK"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si1841698edv.438.2020.08.21.09.48.28; Fri, 21 Aug 2020 09:48:52 -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=@gmail.com header.s=20161025 header.b="kE2/rzVK"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728105AbgHUQpu (ORCPT + 99 others); Fri, 21 Aug 2020 12:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728380AbgHUQUl (ORCPT ); Fri, 21 Aug 2020 12:20:41 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70C09C061573 for ; Fri, 21 Aug 2020 09:20:41 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id f19so1587148qtp.2 for ; Fri, 21 Aug 2020 09:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SnctsuDqqlA5ER6TRf1wGNDf5ctTnVHX934E0v8jiKs=; b=kE2/rzVKhLFjVHa4TBoS4RNn4LkOQyfSEpegQ1o5S1smE6U1gjIbdzoACeuOT1w/hS CFwjGcSYrK3z8ltyVrRDPX1tIaueQtkdUz9d4seWs56SfVhltnNi55DrKsvW/1WK/ygp ewgl0UFESexwf4yIx/m3K60SiHFxgiSXaBsXgyuPY6sr7cFXcUUzM0C9F5iYcFutWwfX gj8tvxTERGCRPf0OuJThfFvRoTUvt+grGqDSGSU+B6sYoVOBBaa5kXcVeP6taU0fXz09 I1k+QPCDHAbdGuNnTID+AENF2qdS+HvW0+sK2irNllXdsy1tgrRT9o+0DOSMH+TD/IFV kjAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SnctsuDqqlA5ER6TRf1wGNDf5ctTnVHX934E0v8jiKs=; b=qTpp36no7g77g+j/BsPO3Ww/9s40Sm50ErTz7JXtM2UuvVbLE3dur87WgEcRv8tz4u GAGKhJdPGkPWN6rGl22/nXsNrSGYGmVJhmYrBHnnCLuOrRVeEtOjI3esS8978rNrq3TN H87KvJo8eF4VPELOwtbbuN9qE9ITbUIqlKGvQgfGOEn5BAomOwfZlzOQq4Wl+avy10z5 uqf+MTj5psdNrCIYzckSti0ktcVvmUugVXMysrXjwH+cHMXAVA3TDOKjMU8l6Dz5wXql Q5BwkNIwhcJO7q2V9rTFC0kfwav5UDQ/917x6rI2/WW75ONFKcGV97YvPgT/KF2u/hFZ HwgA== X-Gm-Message-State: AOAM530gDCQequfr1lx83nnQjU1arjcjxW03JWbHlm3Exm3F5OMfxupL 4BdDke566VQI+PtJ8sS0TZo= X-Received: by 2002:ac8:12cc:: with SMTP id b12mr3312871qtj.349.1598026835922; Fri, 21 Aug 2020 09:20:35 -0700 (PDT) Received: from tong-desktop.local ([2601:5c0:c100:b9d:613a:3cfc:fb4b:2e6]) by smtp.googlemail.com with ESMTPSA id l66sm2465030qte.48.2020.08.21.09.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 09:20:35 -0700 (PDT) From: Tong Zhang To: jikos@kernel.org, dsterba@suse.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, ztong0001@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v3] tty: ipwireless: fix error handling Date: Fri, 21 Aug 2020 12:19:40 -0400 Message-Id: <20200821161942.36589-1-ztong0001@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821092844.GB2026@suse.cz> References: <20200821092844.GB2026@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v2: - According to Jiri's comment, I made the checking consistent with the rest of the kernel. I also rebased the code using f684668a24ec. Thank you Jiri! v3: fix commit log according to David's comment, and rebased using Greg's tty-testing tree. Thank you David! 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 cf20616340a1..fe569f6294a2 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 fad3401e604d..23584769fc29 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; } -- 2.25.1