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 5584CC3F2D1 for ; Tue, 3 Mar 2020 18:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26040214DB for ; Tue, 3 Mar 2020 18:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258790; bh=wezH3LP0LPiLkBoge+fgK2CiR4BSELS3gw6fPaPAwYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=C5vNxbTFudmJXzvhtM4gq3qXJUmV6W9t2EjvY9bbKhHblFjyuFnm8T06T6gy6cE55 0UKJjUggyTbC8k5hyJsW/CkKG26OzWx9bw3N+M7NHd1aW6ePVea05LqiDdUnkPiMij 5q2upvpLa3XgOtfVoRtYO/YVT403gdjF8LMlhZs0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388076AbgCCSG3 (ORCPT ); Tue, 3 Mar 2020 13:06:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:38920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732929AbgCCR4h (ORCPT ); Tue, 3 Mar 2020 12:56:37 -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 CC4DC20728; Tue, 3 Mar 2020 17:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258197; bh=wezH3LP0LPiLkBoge+fgK2CiR4BSELS3gw6fPaPAwYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4KK8Ba9yH1I74KlytiOUsFdRF61UujhwL60VNwDEtM8VzLALPBI5QHclVBByCFOE TJGky5p4WS/3VG0mi1ryeWjqWj2CqI1bFfYLT+kxgbkFCtTv2oA3hXbDYwdWSMz1cr v4Ukqyuq7IRLSjEZ5d1XwQPnpmTzA3DixRFF+kcU= 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.4 108/152] net: atlantic: fix potential error handling Date: Tue, 3 Mar 2020 18:43:26 +0100 Message-Id: <20200303174314.953350288@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174302.523080016@linuxfoundation.org> References: <20200303174302.523080016@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 @@ -467,8 +467,10 @@ static unsigned int aq_nic_map_skb(struc 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;