Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3399702rwa; Tue, 23 Aug 2022 04:15:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR5wxJHl5xXgLMVmj87SI/afgx9OvmXmga4zuLNFYcZt4i/1o0DeYz8TeDbdft+LUq5J7YKI X-Received: by 2002:a17:902:be02:b0:172:d409:e057 with SMTP id r2-20020a170902be0200b00172d409e057mr14304634pls.90.1661253343837; Tue, 23 Aug 2022 04:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253343; cv=none; d=google.com; s=arc-20160816; b=eHIMoWiPb58xeM8rL6KgcdBrj7ILksfOKadYatk5kDwJf8m0UqbXGncFqQzxi2kXm1 3bBFH8qfE1xM7+vtv7C/EG8hgsa6ZKu+WFn62kFOczFEBWKpoRXT5MljX7BDVOXIAnpF s1cmQEr26xuuzhoCSRuHBhEZyS5bmzgAne67i6tXyY8D7xohto9qDcyIjb6KbUEPowC2 3qmdgiNJL1HjjWyvEiLCVrvDSh5Dw+3zkpHTWNFMb4oYVpc5PmTIqeg/Ua4/48QFKuvC Lm+4JK67RNwJf6OxVEh+tPgOlPoowvzqQHee9WHcEja7qmdWfm/k2Xr8DX8/gwra5RPe B1vw== 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=JRS8bwzyxN9xx/nGkIwsLu8VGOmhXqOcvlbxP/6zdz0=; b=fmPnZ2OvnluoS+rrT+cv3pveBZs1b22JkqxYBY3yJY6+IPy3OEkPHWPWw5TKSnWwUR 6cD/r0aa4nkVKbDcWNpTutBpaRFZSoGiOUcD0XBGPeEGT93CKKNxY2vaLsB6SdTeD+/Q mu5XMaaZYiWvL9lp77i3X+Ajsh7i3C26d2wvdIjNOAIQe1v6ZiqCwAisvonXS4Fgeec6 vF68WEUY8SfE/mJux/Rx4WuBhv/XWqmMyErKW2ShxBjQYv1lVKPzeJ1yIPYTldlmL4BC 119Rwh0a9BxnK6JOH34yVO3LVhcrIUTXv2E4xNWQCHfz+9kKc6ZIv5NXJeaJZLTjziCj dzpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GdoemA72; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a655b87000000b0041d00d8df51si14499241pgr.406.2022.08.23.04.15.32; Tue, 23 Aug 2022 04:15:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GdoemA72; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348624AbiHWKIQ (ORCPT + 99 others); Tue, 23 Aug 2022 06:08:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352506AbiHWKCA (ORCPT ); Tue, 23 Aug 2022 06:02:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4185F7C500; Tue, 23 Aug 2022 01:49:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD116B81B90; Tue, 23 Aug 2022 08:49:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E005C433D6; Tue, 23 Aug 2022 08:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244591; bh=X6jgYWZ4Mu4BRn1XVD+JQfc78HmS4SDy8hx0sB+nn/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdoemA72jeiWJn7anC3QowU7ye370EJdbOZGZD5hHKurmmYSSdoZAuWI2u232Foc5 vfHN1F90dvhWfs1mKv0X86pnU3afu+cC4n1Y6fI4d+Xj+21Q8F+uNCPZUEbRmqZxlk GIKloLbuA2Rw0bUqJDnTNJZf2XU9oZhVZmpvYID8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jedrzej Jagielski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.15 115/244] iavf: Fix adminq error handling Date: Tue, 23 Aug 2022 10:24:34 +0200 Message-Id: <20220823080102.854229679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Przemyslaw Patynowski commit 419831617ed349992c84344dbd9e627f9e68f842 upstream. iavf_alloc_asq_bufs/iavf_alloc_arq_bufs allocates with dma_alloc_coherent memory for VF mailbox. Free DMA regions for both ASQ and ARQ in case error happens during configuration of ASQ/ARQ registers. Without this change it is possible to see when unloading interface: 74626.583369: dma_debug_device_change: device driver has pending DMA allocations while released from device [count=32] One of leaked entries details: [device address=0x0000000b27ff9000] [size=4096 bytes] [mapped with DMA_BIDIRECTIONAL] [mapped as coherent] Fixes: d358aa9a7a2d ("i40evf: init code and hardware support") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jedrzej Jagielski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/iavf/iavf_adminq.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/intel/iavf/iavf_adminq.c +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.c @@ -324,6 +324,7 @@ static enum iavf_status iavf_config_arq_ static enum iavf_status iavf_init_asq(struct iavf_hw *hw) { enum iavf_status ret_code = 0; + int i; if (hw->aq.asq.count > 0) { /* queue already initialized */ @@ -354,12 +355,17 @@ static enum iavf_status iavf_init_asq(st /* initialize base registers */ ret_code = iavf_config_asq_regs(hw); if (ret_code) - goto init_adminq_free_rings; + goto init_free_asq_bufs; /* success! */ hw->aq.asq.count = hw->aq.num_asq_entries; goto init_adminq_exit; +init_free_asq_bufs: + for (i = 0; i < hw->aq.num_asq_entries; i++) + iavf_free_dma_mem(hw, &hw->aq.asq.r.asq_bi[i]); + iavf_free_virt_mem(hw, &hw->aq.asq.dma_head); + init_adminq_free_rings: iavf_free_adminq_asq(hw); @@ -383,6 +389,7 @@ init_adminq_exit: static enum iavf_status iavf_init_arq(struct iavf_hw *hw) { enum iavf_status ret_code = 0; + int i; if (hw->aq.arq.count > 0) { /* queue already initialized */ @@ -413,12 +420,16 @@ static enum iavf_status iavf_init_arq(st /* initialize base registers */ ret_code = iavf_config_arq_regs(hw); if (ret_code) - goto init_adminq_free_rings; + goto init_free_arq_bufs; /* success! */ hw->aq.arq.count = hw->aq.num_arq_entries; goto init_adminq_exit; +init_free_arq_bufs: + for (i = 0; i < hw->aq.num_arq_entries; i++) + iavf_free_dma_mem(hw, &hw->aq.arq.r.arq_bi[i]); + iavf_free_virt_mem(hw, &hw->aq.arq.dma_head); init_adminq_free_rings: iavf_free_adminq_arq(hw);