From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 001DBC3F2D1 for ; Tue, 3 Mar 2020 17:50:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD0A1214D8 for ; Tue, 3 Mar 2020 17:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257801; bh=df1CoaM517UsCBfD5xn2Xp++Pd+EC6D9S8s7qekXngI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kGMT6Gu5HE4eLlnx9O2SENpw3tqZChpPgMRcc+gaoBIFhJnLLJ0hHiThtHDOjy3as Z+wpSay/SwsGvIpFP3BX7AxJyIMPIL3LxipAtT8JJuAbpE6JJ9p6xiZEI+ZQWtF+xw uKUCtKGabj1gCvEYxbh1WP0JCuWk4EamF4WDXZ1U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731843AbgCCRt6 (ORCPT ); Tue, 3 Mar 2020 12:49:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:57298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731112AbgCCRty (ORCPT ); Tue, 3 Mar 2020 12:49:54 -0500 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 93BD920CC7; Tue, 3 Mar 2020 17:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257794; bh=df1CoaM517UsCBfD5xn2Xp++Pd+EC6D9S8s7qekXngI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UUmM597vTinhziwSAY6+bvoFe59pIj1PD/LEV7PebA7aRlyzjvfaNCTpoH/5cZv/H jTpXlOyZRKpOS3c+BtI45Ui85gVnkRwQcz7q5rFozwTiWHVmeXoZ0Wi8jvKYTf8ItZ kyZ3pz8WsbfGZPR/J9UYMaXfxhwWvKlagVGhhlJg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Belous , Igor Russkikh , Dmitry Bogdanov , "David S. Miller" Subject: [PATCH 5.5 130/176] net: atlantic: fix potential error handling Date: Tue, 3 Mar 2020 18:43:14 +0100 Message-Id: <20200303174319.774481986@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174304.593872177@linuxfoundation.org> References: <20200303174304.593872177@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Belous commit 380ec5b9af7f0d57dbf6ac067fd9f33cff2fef71 upstream. Code inspection found that in case of mapping error we do return current 'ret' value. But beside error, it is used to count number of descriptors allocated for the packet. In that case map_skb function could return '1'. Changing it to return zero (number of mapped descriptors for skb) Fixes: 018423e90bee ("net: ethernet: aquantia: Add ring support code") Signed-off-by: Pavel Belous Signed-off-by: Igor Russkikh Signed-off-by: Dmitry Bogdanov Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -533,8 +533,10 @@ unsigned int aq_nic_map_skb(struct aq_ni dx_buff->len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa))) + if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa))) { + ret = 0; goto exit; + } first = dx_buff; dx_buff->len_pkt = skb->len;