From patchwork Fri Jun 19 14:32:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223674 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=-9.8 required=3.0 tests=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=unavailable 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 E4B5CC433DF for ; Fri, 19 Jun 2020 16:45:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1FE621527 for ; Fri, 19 Jun 2020 16:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592585100; bh=b/50F7gkO3+K/pAR6DbtLDdBm4g7DWks/GCUmwikn3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WIWgSiUPdzxZ2TpotHjWD6zfECdLtb7Zh0rEI0mtuDiNgUl51Y1ZmXXdP5Fp6nFb0 w3oItiILMHCX2N1J09mcKz1IITvi68C7aYlpetoizFzEhtruNcFcvZkqCo27vuaTg1 R5CbHcIv4KT1jfSaqRo3zZpFZ4Zklu+zZdivEGLc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388973AbgFSQo4 (ORCPT ); Fri, 19 Jun 2020 12:44:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:33436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388390AbgFSOmj (ORCPT ); Fri, 19 Jun 2020 10:42:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 8625F20CC7; Fri, 19 Jun 2020 14:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577759; bh=b/50F7gkO3+K/pAR6DbtLDdBm4g7DWks/GCUmwikn3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+BOkUFEAhtrjnqiUh+PL5lTr7XE6nAyP9EE451tJFQLvpea1jJ4F5msklfMhp3BH GV980X+XKKRcXoir4Gjbs8D6HRaQnYN9jMMW67OtJMFzW34ozZUmsWqKQ7z1xjTp03 xibHvmB+lHruIJg2oAV8vbiG0joQDzfVyFH010bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunjian Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 077/128] net: allwinner: Fix use correct return type for ndo_start_xmit() Date: Fri, 19 Jun 2020 16:32:51 +0200 Message-Id: <20200619141624.256867958@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141620.148019466@linuxfoundation.org> References: <20200619141620.148019466@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yunjian Wang [ Upstream commit 09f6c44aaae0f1bdb8b983d7762676d5018c53bc ] The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix the ndo function to use the correct type. And emac_start_xmit() can leak one skb if 'channel' == 3. Signed-off-by: Yunjian Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 6ffdff68bfc4..672a8212c8d9 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -412,7 +412,7 @@ static void emac_timeout(struct net_device *dev) /* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t emac_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct emac_board_info *db = netdev_priv(dev); unsigned long channel; @@ -420,7 +420,7 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) channel = db->tx_fifo_stat & 3; if (channel == 3) - return 1; + return NETDEV_TX_BUSY; channel = (channel == 1 ? 1 : 0);