Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2494570rwb; Mon, 3 Oct 2022 01:17:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lKsJlMcprA9J+EpHp8Xfqg/MQ4118lEIqs/kHotvmW9/UnPb+Yus/Hq4nKukbDeP9USXg X-Received: by 2002:a17:902:7444:b0:17f:3da:f190 with SMTP id e4-20020a170902744400b0017f03daf190mr5637455plt.117.1664785025035; Mon, 03 Oct 2022 01:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664785025; cv=none; d=google.com; s=arc-20160816; b=08svneUCgbSRjjLDbxtJKc1Tfv/rpvOCPiaDQQ2WZ2Gj8cyAZcEpoK5kIFIac9j69M 31v0vSeyLzl8SJOMnuHPCifcAhHLBiyr8YmDDgU7LDo6RFF4h5ZvXj+5UODoex38M6dR p+mDrrIXIn5y4FHvdqcuEqzOhkz3LKrcasQFmWtEx2bftMFmQkWuKBTxPiaLFzJQM2aq 9DTv/cTy0aFtdjuGyNAPi4TwtzYKb/4+gBjOB6oj+51QCHpHeOmI2LIA1q6LKk1UCuQc EKpJAT1eCbSt2pdIXNfMxoSsUBmu399L3RjuZbZO79GebUMFc9W547HOriT32T63MQ+7 nxBw== 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=OHQrZLNP+NHKZHwdfAOllW1KmLsibqUsR6Zscub3otw=; b=GU5/LDBw/DbXOxFHNYjvZH4EKAFknzP9PHB+TNhxXiDJKuRkIzOmx3gVvF38LyLUPo iVT0fSECWuzlvDzXEFdMTK40HqOd09niltIlFAdXxAzwDcYV59mvxDFpU10r4T1QOYtp SrotKY3kHuvGrxflbuxmOrTQHHD4mxwDUasuxBXYpvg4vTGsQH2aWhvPuX2+q+TAA4Xr eHItu2X5jEjbHPM2Bbp9tk4MKFzM7JlIZ6xNC2+DrBJwX2vTszCkwgPTLi0BQZdxxq+M szKTiyiLCTPd3lUhFi4CReRfASsMU5MReu/t7O18KbmTZS8jh48bC4jyGEpExVHi+peQ u9YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FLIqePXz; 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 x15-20020a170902ec8f00b00176955c81eesi11387202plg.247.2022.10.03.01.16.53; Mon, 03 Oct 2022 01:17:05 -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=FLIqePXz; 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 S231866AbiJCHkS (ORCPT + 99 others); Mon, 3 Oct 2022 03:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232076AbiJCHi6 (ORCPT ); Mon, 3 Oct 2022 03:38:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DCC054652; Mon, 3 Oct 2022 00:24:00 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A686A60FB6; Mon, 3 Oct 2022 07:22:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2BE9C433C1; Mon, 3 Oct 2022 07:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781730; bh=7Ee1OiwnARdS34yyfr/is4CY2iTSUYSNsSorZjOpbA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLIqePXzhGRMH+9P14yybffMzrRUWL+/N+EliaFPZLEEijDQm4qn9qVRXjfH5YQDT YC42LwM1cKsAKdAcUnChlxB5f0EX/XEm2Tlc9TR8kaCZFhftMr08br4XPHM5UiRLO3 56QAbRSol+48u1n6Sp3TfPCitGSsWof/5w0fzG18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Rahul Lakkireddy , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 43/52] cxgb4: fix missing unlock on ETHOFLD desc collect fail path Date: Mon, 3 Oct 2022 09:11:50 +0200 Message-Id: <20221003070720.016459549@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070718.687440096@linuxfoundation.org> References: <20221003070718.687440096@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 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: Rafael Mendonca [ Upstream commit c635ebe8d911a93bd849a9419b01a58783de76f1 ] The label passed to the QDESC_GET for the ETHOFLD TXQ, RXQ, and FLQ, is the 'out' one, which skips the 'out_unlock' label, and thus doesn't unlock the 'uld_mutex' before returning. Additionally, since commit 5148e5950c67 ("cxgb4: add EOTID tracking and software context dump"), the access to these ETHOFLD hardware queues should be protected by the 'mqprio_mutex' instead. Fixes: 2d0cb84dd973 ("cxgb4: add ETHOFLD hardware queue support") Fixes: 5148e5950c67 ("cxgb4: add EOTID tracking and software context dump") Signed-off-by: Rafael Mendonca Reviewed-by: Rahul Lakkireddy Link: https://lore.kernel.org/r/20220922175109.764898-1-rafaelmendsr@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- .../net/ethernet/chelsio/cxgb4/cudbg_lib.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c index c5b0e725b238..2169351b6afc 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c @@ -14,6 +14,7 @@ #include "cudbg_entity.h" #include "cudbg_lib.h" #include "cudbg_zlib.h" +#include "cxgb4_tc_mqprio.h" static const u32 t6_tp_pio_array[][IREG_NUM_ELEM] = { {0x7e40, 0x7e44, 0x020, 28}, /* t6_tp_pio_regs_20_to_3b */ @@ -3476,7 +3477,7 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i = 0; i < utxq->ntxq; i++) QDESC_GET_TXQ(&utxq->uldtxq[i].q, cudbg_uld_txq_to_qtype(j), - out_unlock); + out_unlock_uld); } } @@ -3493,7 +3494,7 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i = 0; i < urxq->nrxq; i++) QDESC_GET_RXQ(&urxq->uldrxq[i].rspq, cudbg_uld_rxq_to_qtype(j), - out_unlock); + out_unlock_uld); } /* ULD FLQ */ @@ -3505,7 +3506,7 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i = 0; i < urxq->nrxq; i++) QDESC_GET_FLQ(&urxq->uldrxq[i].fl, cudbg_uld_flq_to_qtype(j), - out_unlock); + out_unlock_uld); } /* ULD CIQ */ @@ -3518,29 +3519,34 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i = 0; i < urxq->nciq; i++) QDESC_GET_RXQ(&urxq->uldrxq[base + i].rspq, cudbg_uld_ciq_to_qtype(j), - out_unlock); + out_unlock_uld); } } + mutex_unlock(&uld_mutex); + + if (!padap->tc_mqprio) + goto out; + mutex_lock(&padap->tc_mqprio->mqprio_mutex); /* ETHOFLD TXQ */ if (s->eohw_txq) for (i = 0; i < s->eoqsets; i++) QDESC_GET_TXQ(&s->eohw_txq[i].q, - CUDBG_QTYPE_ETHOFLD_TXQ, out); + CUDBG_QTYPE_ETHOFLD_TXQ, out_unlock_mqprio); /* ETHOFLD RXQ and FLQ */ if (s->eohw_rxq) { for (i = 0; i < s->eoqsets; i++) QDESC_GET_RXQ(&s->eohw_rxq[i].rspq, - CUDBG_QTYPE_ETHOFLD_RXQ, out); + CUDBG_QTYPE_ETHOFLD_RXQ, out_unlock_mqprio); for (i = 0; i < s->eoqsets; i++) QDESC_GET_FLQ(&s->eohw_rxq[i].fl, - CUDBG_QTYPE_ETHOFLD_FLQ, out); + CUDBG_QTYPE_ETHOFLD_FLQ, out_unlock_mqprio); } -out_unlock: - mutex_unlock(&uld_mutex); +out_unlock_mqprio: + mutex_unlock(&padap->tc_mqprio->mqprio_mutex); out: qdesc_info->qdesc_entry_size = sizeof(*qdesc_entry); @@ -3578,6 +3584,10 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, #undef QDESC_GET return rc; + +out_unlock_uld: + mutex_unlock(&uld_mutex); + goto out; } int cudbg_collect_flash(struct cudbg_init *pdbg_init, -- 2.35.1